import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法，replace方法就把VueRouter.prototype.push的push换成replace即可
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
import routerList from "./router"
const routes = routerList

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
